
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 12/02/2013 11:57:30
-- Generated from EDMX file: C:\Cours_Insta\Projets à soutenir\Projet C#- Pour Elles\MVC Project\MvcAppli.PourL.V1\MVCProject.PourL.BLL\ModelMvcPourL.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [dbPourLTest];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_FemmeEnceinte_inherits_Personne]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PersonneSet_FemmeEnceinte] DROP CONSTRAINT [FK_FemmeEnceinte_inherits_Personne];
GO
IF OBJECT_ID(N'[dbo].[FK_Medecin_inherits_Personne]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PersonneSet_Medecin] DROP CONSTRAINT [FK_Medecin_inherits_Personne];
GO

-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[PersonneSet]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PersonneSet];
GO
IF OBJECT_ID(N'[dbo].[PersonneSet_FemmeEnceinte]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PersonneSet_FemmeEnceinte];
GO
IF OBJECT_ID(N'[dbo].[PersonneSet_Medecin]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PersonneSet_Medecin];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'PersonneSet'
CREATE TABLE [dbo].[PersonneSet] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Nom] nvarchar(max)  NOT NULL,
    [Prenom] nvarchar(max)  NOT NULL,
    [Email] nvarchar(max)  NOT NULL,
    [Pwd] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'PersonneSet_FemmeEnceinte'
CREATE TABLE [dbo].[PersonneSet_FemmeEnceinte] (
    [Age] int  NOT NULL,
    [Adresse] nvarchar(max)  NOT NULL,
    [CodePostal] int  NOT NULL,
    [Ville] nvarchar(max)  NOT NULL,
    [Id] int  NOT NULL
);
GO

-- Creating table 'PersonneSet_Medecin'
CREATE TABLE [dbo].[PersonneSet_Medecin] (
    [Specialisation] nvarchar(max)  NOT NULL,
    [AnneeExcercice] int  NOT NULL,
    [Localisation] nvarchar(max)  NOT NULL,
    [Id] int  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [Id] in table 'PersonneSet'
ALTER TABLE [dbo].[PersonneSet]
ADD CONSTRAINT [PK_PersonneSet]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PersonneSet_FemmeEnceinte'
ALTER TABLE [dbo].[PersonneSet_FemmeEnceinte]
ADD CONSTRAINT [PK_PersonneSet_FemmeEnceinte]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PersonneSet_Medecin'
ALTER TABLE [dbo].[PersonneSet_Medecin]
ADD CONSTRAINT [PK_PersonneSet_Medecin]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [Id] in table 'PersonneSet_FemmeEnceinte'
ALTER TABLE [dbo].[PersonneSet_FemmeEnceinte]
ADD CONSTRAINT [FK_FemmeEnceinte_inherits_Personne]
    FOREIGN KEY ([Id])
    REFERENCES [dbo].[PersonneSet]
        ([Id])
    ON DELETE CASCADE ON UPDATE NO ACTION;
GO

-- Creating foreign key on [Id] in table 'PersonneSet_Medecin'
ALTER TABLE [dbo].[PersonneSet_Medecin]
ADD CONSTRAINT [FK_Medecin_inherits_Personne]
    FOREIGN KEY ([Id])
    REFERENCES [dbo].[PersonneSet]
        ([Id])
    ON DELETE CASCADE ON UPDATE NO ACTION;
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------